home *** CD-ROM | disk | FTP | other *** search
/ Champak 40 / Vol 40.iso / games / draw_pla.swf / scripts / frame_27 / DoAction.as
Encoding:
Text File  |  2007-05-10  |  1.1 KB  |  51 lines

  1. stop();
  2. _root.nono = false;
  3. _root.mtrue.bar = 650;
  4. if(_root.medium == true)
  5. {
  6.    _root.mtrue.gotoAndStop(2);
  7. }
  8. _root.onMouseDown = function()
  9. {
  10.    if(_root.mtrue.bar > 0)
  11.    {
  12.       _root.ground.moveTo(_xmouse,_ymouse);
  13.       _root.ground.lineTo(_xmouse + 1,_ymouse + 1);
  14.       if(_root.medium == true)
  15.       {
  16.          _root.mtrue.bar -= 12;
  17.       }
  18.       _root.dist = 0;
  19.       _root.prevx = _xmouse;
  20.       _root.prevy = _ymouse;
  21.       mousedown = true;
  22.    }
  23. };
  24. _root.onMouseUp = function()
  25. {
  26.    if(_root.mtrue.bar > 0)
  27.    {
  28.       mousedown = false;
  29.    }
  30. };
  31. _root.onMouseMove = function()
  32. {
  33.    if(mousedown)
  34.    {
  35.       if(_root.mtrue.bar > 0)
  36.       {
  37.          _root.xdiff = prevx - _xmouse;
  38.          _root.ydiff = prevy - _ymouse;
  39.          _root.dist = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  40.          if(_root.medium == true)
  41.          {
  42.             _root.mtrue.bar -= _root.dist;
  43.          }
  44.          _root.dist = 0;
  45.          prevx = _xmouse;
  46.          prevy = _ymouse;
  47.          _root.ground.lineTo(_xmouse,_ymouse);
  48.       }
  49.    }
  50. };
  51.